package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConTouristTrafficUpload;
import com.htgd.gardenexpo.dao.GeConTouristTrafficUploadDao;
import com.htgd.gardenexpo.service.GeConTouristTrafficUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConTouristTrafficUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-09 14:07:54
 */
@Service("geConTouristTrafficUploadService")
public class GeConTouristTrafficUploadServiceImpl implements GeConTouristTrafficUploadService {
    @Resource
    private GeConTouristTrafficUploadDao geConTouristTrafficUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConTouristTrafficUpload queryById(Integer id) {
        return this.geConTouristTrafficUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConTouristTrafficUpload> queryAllByLimit(int offset, int limit) {
        return this.geConTouristTrafficUploadDao.queryAllByLimit(offset, limit);
    }
    @Override
    public List<GeConTouristTrafficUpload> queryByTrafficId(int id) {
        return this.geConTouristTrafficUploadDao.queryByTrafficId(id);
    }

    /**
     * 新增数据
     *
     * @param geConTouristTrafficUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConTouristTrafficUpload insert(GeConTouristTrafficUpload geConTouristTrafficUpload) {
        this.geConTouristTrafficUploadDao.insert(geConTouristTrafficUpload);
        return geConTouristTrafficUpload;
    }

    /**
     * 修改数据
     *
     * @param geConTouristTrafficUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConTouristTrafficUpload update(GeConTouristTrafficUpload geConTouristTrafficUpload) {
        this.geConTouristTrafficUploadDao.update(geConTouristTrafficUpload);
        return this.queryById(geConTouristTrafficUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConTouristTrafficUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByTrafficId(Integer id) {
        return this.geConTouristTrafficUploadDao.deleteByTrafficId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int tid) {
        return this.geConTouristTrafficUploadDao.deleteByIds(id,tid) > 0;
    }
}
